package com.link2room.rodimus.controller.api;

import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.rodimus.dto.param.api.RankingListApiParamDto;
import com.link2room.rodimus.facade.IRankingListApiFacadeService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by VegetaKo on 2016/11/20.
 */
@Api(tags = "Rankinglist")
@RestController
@RequestMapping("/api/Rankinglist")
public class RankingListApiController {
    @Resource
    private IRankingListApiFacadeService rankingListApiFacadeService;

    @RequestMapping(method = RequestMethod.GET)
    public BaseResultDto getSalesmanRankingList(
            @RequestParam(name = "lhotelCode", required = false) String lhotelCode,
            @RequestParam(value = "currentPage" ,required = false) Integer currentPage,
            @RequestParam(value = "pageSize" ,required = false) Integer pageSize,
            @RequestParam(value = "startDatetime" ,required = false) String startDatetime,
            @RequestParam(name = "rankingListType", required = false) String rankingListType,
            @RequestParam(name = "rankingListFocus", required = false) String rankingListFocus) throws Exception {
        BaseResultDto baseResultDto = new BaseResultDto();
        baseResultDto.setResultCode(0);

        RankingListApiParamDto rankingListApiParamDto = new RankingListApiParamDto();
        rankingListApiParamDto.setLhotelCode( lhotelCode);
        rankingListApiParamDto.setRankingListType( rankingListType);
        rankingListApiParamDto.setRankingListFocus(rankingListFocus );
        rankingListApiParamDto.setCurrentPage(currentPage );
        rankingListApiParamDto.setPageSize(pageSize );
        rankingListApiParamDto.setStartDatetime( startDatetime);
        baseResultDto.setQueryResult(rankingListApiFacadeService.getRankingList(rankingListApiParamDto));
        return baseResultDto;
    }
}
